package o;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.util.StateSet;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.util.ArrayList;

@RestrictTo({d.LIBRARY_GROUP})
public final class ase {
    private final AnimatorListener ˊ = new AnimatorListenerAdapter(this) {
        final /* synthetic */ ase ˊ;

        {
            this.ˊ = r1;
        }

        public void onAnimationEnd(Animator animator) {
            if (this.ˊ.ˋ == animator) {
                this.ˊ.ˋ = null;
            }
        }
    };
    ValueAnimator ˋ = null;
    private a ˎ = null;
    private final ArrayList<a> ॱ = new ArrayList();

    static class a {
        final int[] ˋ;
        final ValueAnimator ˏ;

        a(int[] iArr, ValueAnimator valueAnimator) {
            this.ˋ = iArr;
            this.ˏ = valueAnimator;
        }
    }

    public void ˏ(int[] iArr, ValueAnimator valueAnimator) {
        a aVar = new a(iArr, valueAnimator);
        valueAnimator.addListener(this.ˊ);
        this.ॱ.add(aVar);
    }

    public void ˎ(int[] iArr) {
        a aVar;
        int size = this.ॱ.size();
        for (int i = 0; i < size; i++) {
            aVar = (a) this.ॱ.get(i);
            if (StateSet.stateSetMatches(aVar.ˋ, iArr)) {
                break;
            }
        }
        aVar = null;
        if (aVar != this.ˎ) {
            if (this.ˎ != null) {
                ˎ();
            }
            this.ˎ = aVar;
            if (aVar != null) {
                ॱ(aVar);
            }
        }
    }

    private void ॱ(a aVar) {
        this.ˋ = aVar.ˏ;
        this.ˋ.start();
    }

    private void ˎ() {
        if (this.ˋ != null) {
            this.ˋ.cancel();
            this.ˋ = null;
        }
    }

    public void ˊ() {
        if (this.ˋ != null) {
            this.ˋ.end();
            this.ˋ = null;
        }
    }
}
